#ifndef __SETTING_H__
#define __SETTING_H__

#include "cocos2d.h"
#include "ResString.h"

using namespace cocos2d;

#define MAX_HEALTH_LEVEL 10
#define MAX_GUN_LEVEL 10
#define MAX_DEADLY_SHOOT_LEVEL 10

#define HEALTH_COST 50
#define GUN_COST 100
#define DEADLY_SHOOT_COST 50

#define HEALTH_UPGRADE 25
#define GUN_UPGRADE 10
#define DEADLY_SHOOT_UPGRADE 5
#define BASE_GUN_POWER 50
#define DEADLY_SHOOT_POWER 2

class Creature;

class Setting
{
public:

	Setting(void);
	~Setting(void);

	CC_SYNTHESIZE(int, d_totalMoney, TotalMoney)
	CC_SYNTHESIZE(int, d_gunLevel, GunLevel)
	CC_SYNTHESIZE(float, d_healthLevel, HealthLevel)
	CC_SYNTHESIZE(float, d_deadlyShootLevel, DeadlyShootLevel)
	CC_SYNTHESIZE(int, d_bgVolume, BgVolume)
	CC_SYNTHESIZE(int, d_effectVolume, EffectVolume)
	

	int getHP(int hp, Creature* creature);
	float getShootInterval(float shootInterval, Creature* creature);
	float getBulletSpeed(float bulletSpeed, Creature* creature);
	float getSpeed(float speed, Creature* creature);
	int getDamage(int damage, Creature* creature);
	int getPlayerDamage();
	float getDeadlyShootRate();
	float getDeadlyShootPower();
	float getHealthBuff();
	int getMoney(int money, Creature* creature);
	CCSize getFieldSize() {return _fieldSize;}
	
	bool upgradeGun();
	bool upgradeHealth();
	bool upgradeDeadlyShoot();

	bool cost(int money);
	void earn(int money);
	
	int getWave();
	void setWave(int wave);

	// save state
	int getMaxWave();
	void setMaxWave(int wave);

	const char* getStr(char* key) {return d_resString->getStr(key);};

protected:

private:
	CCSize _fieldSize;
	int _FactorEnemyMaxHP;
	float _FactorEnemyShootInterval;
	float _FactorEnemyBulletSpeed;
	float _FactorEnemySpeed;
	float _FactorEnemyDamage;

	float _FactorTeethHealth;
	float _FactorPlayerDamage;
	float _FactorPlayerDeadlyShoot;

	int _FactorEnemyMoney;

	int d_maxWave;
	int d_wave;
	CCUserDefault* d_save;
	ResString* d_resString;
};

#endif // __SETTING_H__

